package utils

import (
	"net"
	"strings"
)

// IsValidCIDR checks if the given string is a valid IP address or CIDR notation.
func IsValidCIDR(cidr string) bool {
	cidr = strings.TrimSpace(cidr)
	if ip := net.ParseIP(cidr); ip != nil {
		return true
	}
	_, _, err := net.ParseCIDR(cidr)
	return err == nil
}
